<template>
  <h1>个人资料</h1>
    <el-descriptions column="1" size="large" border style="margin-top: 30px; margin-bottom: 30px">
        <el-descriptions-item label="用户类型">{{usertype}}</el-descriptions-item>
        <el-descriptions-item label="邮箱">{{username}}</el-descriptions-item>
        <el-descriptions-item label="真实姓名">许文冲</el-descriptions-item>
        <el-descriptions-item label="牙齿模型数量">0</el-descriptions-item>
        <el-descriptions-item label="疗程数">0</el-descriptions-item>
    </el-descriptions>
  <span>
      <el-button
          type="primary"
          style="font-size: 16px"
          text>
          修改密码
      </el-button>
  </span>
  <span>
      <el-button
          type="primary"
          style="font-size: 16px"
          text
          @click="logout">
          退出登录
      </el-button>
  </span>
</template>

<script>
export default {
    name: "Profile",
    computed: {
        username: function () {
            return this.$store.state.username
        },
        usertype: function () {
            if (this.$store.state.is_login_dentist) {
                return '医生'
            } else {
                return '病人'
            }
        }
    },
    methods: {
        logout: function () {
            this.$store.state.username = ''
            this.$store.state.is_login = false
            this.$store.state.is_login_patient = false
            this.$store.state.is_login_dentist = false
            this.$router.replace('/')
        }
    }
}
</script>

<style scoped>
h1 {
    font-size: 30px;
}
</style>